package com.example.controller;

import com.example.pojo.User4;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/users")
public class Usercontroller {

    public Object init(){
        User4 user1  =new User4(1001,"deep","12345657",1);
        User4 user2 =new User4(1002,"deepS","12345657",1);
        User4 user3  =new User4(1003,"deepE","12345657",1);
        List<User4>users=new ArrayList<>();
        users.add(user1);
        users.add(user2);
        users.add(user3);
        return  users;
    }
    @GetMapping("/query")
    public Object getuserList(){

       return this.init();
    }


    @PostMapping("/query/{userid}")
    public String getuserbyid(@RequestParam("userid") Integer userid){

        return userid+ "accp";
    }

    @GetMapping("/checkUser")
    public Object checkUser(@RequestParam("userName") String  userName,@RequestParam("password") String password){

        return "CHECKED";
    }
}
